
package com.ce.server.common;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.InitBinder;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;


/**
 * @DATE: 2021/11/25 00:16
 * @Author: 小爽帅到拖网速
 */

@Component
public class DateConverter implements Converter<String, LocalDate> {


  @Override
  public LocalDate convert(String source) {

    try {
      return LocalDate.parse(source, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }

}

